--[[
战斗ui
]]
local FightSceneUI = class("FightSceneUI", BaseSprite)





function FightSceneUI:initView(model)
    
    
    if model.levelType_ == 1 then
	    local valueLabel = cc.ui.UILabel.new({
	    		text = "能量条", size = 14, color = display.COLOR_WHITE
	    	})
		    :align(display.LEFT_TOP, display.left + 50, display.top - 40)
		    :addTo(self)
		    
		    
	    self.slider_ = cc.ui.UISlider.new(display.LEFT_TO_RIGHT, {
	            bar = "#CenterFlag.png",
	            button = "#EnemyHp.png",
	        })
	        :onSliderValueChanged(function(event)
	            --valueLabel:setString(string.format("value = %0.2f", event.value))
	        end)
	        :setSliderEnabled(false)
	        :setSliderValue(0)
	        :align(display.LEFT_TOP, display.left + 40, display.top - 60)
	        :addTo(self)
	     
	     
	     
	     GameCoreManager:addEventListener(EventConstants.CurrentEnergys, function(event)
	           self.slider_:setSliderValue(event.data);
	     end)
	     --[[
	     self:addNodeEventListener(cc.NODE_ENTER_FRAME_EVENT, function(dt)
           self:tick(dt)
        end)
        self:scheduleUpdate()
        ]]
  end  
  
  
  
  
  
	    
    self.txt_destoryCards_ = cc.ui.UILabel.new({
    		text = "总销毁个数：0", size = 14, color = display.COLOR_WHITE
    	})
	    :align(display.LEFT_TOP, display.left + 50, display.top - 130)
	    :addTo(self)
	    
	    
	 self.txt_stepNums_  = cc.ui.UILabel.new({
    		text = "总步数：0", size = 14, color = display.COLOR_WHITE
    	})
	    :align(display.LEFT_TOP, display.left + 50, display.top - 150)
	    :addTo(self)
    
    
    
    
    --步数变化
	GameCoreManager:addEventListener(EventConstants.StepNums, function(event)
           self.txt_stepNums_:setString("总步数： " ..event.data);
     end)
     GameCoreManager:addEventListener(EventConstants.DestoryCards, function(event)
           self.txt_destoryCards_:setString("总销毁个数： " ..event.data);
     end)
	 
	 
end






--[[
function FightSceneUI:tick(dt)
	self.dt_ = self.dt_ or 0;
	self.dt_ = self.dt_ + dt;
	if self.dt_ > 1 then
		local value = self.slider_:getSliderValue()+1;
		if value > 100 then
			value = 100;
		end
		self.slider_:setSliderValue(value);
		self.dt_ = 0;
	end
end
]]

return FightSceneUI
